Skip to content

Make kubearchive admins of the product-kubearchive-logging component #7568

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged

Conversation

maruiz93
Copy link
Contributor

The kubearchive team should be able to check logs, do port-forwards and manipulate resources to troubleshoot potential issues in this component.

@openshift-ci openshift-ci bot requested review from lcarva and psturc August 11, 2025 07:19
Copy link
Contributor

Code Review by Gemini

```diff
--- a/components/vector-kubearchive-log-collector/base/rbac.yaml
+++ b/components/vector-kubearchive-log-collector/base/rbac.yaml
@@ -3,7 +3,7 @@
 apiVersion: rbac.authorization.k8s.io/v1
 metadata:
   name: kubearchive-logging-component-maintainers
-  namespace: kubearchive
+  namespace: product-kubearchive-logging
 subjects:
   - kind: Group
     apiGroup: rbac.authorization.k8s.io
@@ -14,13 +14,10 @@
   kind: ClusterRole
   name: component-maintainer
 ---
-kind: RoleBinding
-apiVersion: rbac.authorization.k8s.io/v1
-metadata:
-  name: kubearchive-logging-admin
-  namespace: kubearchive
-subjects:
-  - kind: Group
-    apiGroup: rbac.authorization.k8s.io
-    name: konflux-kubearchive  # rover group
-roleRef:
-  apiGroup: rbac.authorization.k8s.io
-  kind: ClusterRole
-  name: admin
+

Reasoning for change:
The RoleBinding is intended for the product-kubearchive-logging component, as indicated by the kustomization.yaml and the commit message. The namespace field in the RoleBinding must match the target namespace where the permissions are to be applied.

--- a/components/vector-kubearchive-log-collector/base/rbac.yaml
+++ b/components/vector-kubearchive-log-collector/base/rbac.yaml
@@ -10,13 +10,3 @@
   apiGroup: rbac.authorization.k8s.io
   kind: ClusterRole
   name: component-maintainer
----
-kind: RoleBinding
-apiVersion: rbac.authorization.k8s.io/v1
-metadata:
-  name: kubearchive-logging-admin
-  namespace: kubearchive
-subjects:
-  - kind: Group
-    apiGroup: rbac.authorization.k8s.io
-    name: konflux-kubearchive  # rover group
-roleRef:
-  apiGroup: rbac.authorization.k8s.io
-  kind: ClusterRole
-  name: admin

Reasoning for change:
The commit message states the intent is to make kubearchive "admins" of the component. Granting both component-maintainer and admin ClusterRoles to the same group in the same namespace is redundant, as the admin role typically encompasses or exceeds the permissions of a component-maintainer role. To avoid over-permissioning or confusion, only the admin role binding should be kept if that is the desired level of access. If component-maintainer is sufficient, then admin should be removed. Assuming "admin" level access is truly required as per the commit title, the component-maintainer binding is superfluous.

--- a/components/vector-kubearchive-log-collector/base/rbac.yaml
+++ b/components/vector-kubearchive-log-collector/base/rbac.yaml
@@ -0,0 +1,16 @@
+---
+kind: RoleBinding
+apiVersion: rbac.authorization.k8s.io/v1
+metadata:
+  name: kubearchive-logging-admin
+  namespace: product-kubearchive-logging
+subjects:
+  - kind: Group
+    apiGroup: rbac.authorization.k8s.io
+    name: konflux-kubearchive  # rover group
+roleRef:
+  apiGroup: rbac.authorization.k8s.io
+  kind: ClusterRole
+  name: admin
+

Reasoning for change:
This is the corrected RoleBinding for the admin role, incorporating the correct namespace and removing the redundant component-maintainer binding. This aligns with the commit message's intent to make the group "admins" of the component.

@rh-hemartin
Copy link
Contributor

/approve
/lgtm

@maruiz93 maruiz93 force-pushed the rbac-perms-k9e-logging branch from c5dc242 to 0d9a5a9 Compare August 11, 2025 07:45
@openshift-ci openshift-ci bot removed the lgtm label Aug 11, 2025
Copy link

openshift-ci bot commented Aug 11, 2025

New changes are detected. LGTM label has been removed.

Copy link
Contributor

Code Review by Gemini

### Review of changes

The changes introduce new RBAC configurations for the `product-kubearchive-logging` namespace and also include unrelated image tag updates in `mintmaker` components.

**Issues and Suggestions:**

1.  **Unrelated Changes in `mintmaker` Kustomizations:**
    The changes to `components/mintmaker/production/*/kustomization.yaml` files, specifically the addition of the `images` section, are unrelated to the commit message "Make kubearchive admins of the product-kubearchive-logging component". These changes should be reverted or moved to a separate pull request to maintain a clear and focused commit history.

    *   **File:** `components/mintmaker/production/kflux-ocp-p01/kustomization.yaml`
        ```diff
        --- a/components/mintmaker/production/kflux-ocp-p01/kustomization.yaml
        +++ b/components/mintmaker/production/kflux-ocp-p01/kustomization.yaml
        @@ -1,15 +1,21 @@
         apiVersion: kustomize.config.k8s.io/v1beta1
         kind: Kustomization
         resources:
         - ../base
         namespace: mintmaker
        +
        +images:
        +  - name: quay.io/konflux-ci/mintmaker
        +    newName: quay.io/konflux-ci/mintmaker
        +    newTag: a3816e76f5e06ba3114731fc34fa14f76d442b6c
        +
         patches:
           - path: pipelines-as-code-secret-path.yaml
             target:
               name: pipelines-as-code-secret
               group: external-secrets.io
               version: v1beta1
               kind: ExternalSecret
        
         components:
           - ../../components/rh-certs
        ```
        **Suggestion:** Remove lines 6-10.

    *   **File:** `components/mintmaker/production/kflux-osp-p01/kustomization.yaml`
        ```diff
        --- a/components/mintmaker/production/kflux-osp-p01/kustomization.yaml
        +++ b/components/mintmaker/production/kflux-osp-p01/kustomization.yaml
        @@ -1,14 +1,20 @@
         apiVersion: kustomize.config.k8s.io/v1beta1
         kind: Kustomization
         resources:
         - ../base
         namespace: mintmaker
        +
        +images:
        +  - name: quay.io/konflux-ci/mintmaker
        +    newName: quay.io/konflux-ci/mintmaker
        +    newTag: a3816e76f5e06ba3114731fc34fa14f76d442b6c
        +
         patches:
           - path: pipelines-as-code-secret-path.yaml
             target:
               name: pipelines-as-code-secret
               group: external-secrets.io
               version: v1beta1
               kind: ExternalSecret
         components:
           - ../../components/rh-certs
        ```
        **Suggestion:** Remove lines 6-10.

    *   **File:** `components/mintmaker/production/kflux-prd-rh02/kustomization.yaml`
        ```diff
        --- a/components/mintmaker/production/kflux-prd-rh02/kustomization.yaml
        +++ b/components/mintmaker/production/kflux-prd-rh02/kustomization.yaml
        @@ -1,12 +1,18 @@
         apiVersion: kustomize.config.k8s.io/v1beta1
         kind: Kustomization
         resources:
         - ../base
         namespace: mintmaker
        +
        +images:
        +  - name: quay.io/konflux-ci/mintmaker
        +    newName: quay.io/konflux-ci/mintmaker
        +    newTag: a3816e76f5e06ba3114731fc34fa14f76d442b6c
        +
         patches:
           - path: pipelines-as-code-secret-path.yaml
             target:
               name: pipelines-as-code-secret
               group: external-secrets.io
               version: v1beta1
               kind: ExternalSecret
        ```
        **Suggestion:** Remove lines 6-10.

    *   **File:** `components/mintmaker/production/kflux-prd-rh03/kustomization.yaml`
        ```diff
        --- a/components/mintmaker/production/kflux-prd-rh03/kustomization.yaml
        +++ b/components/mintmaker/production/kflux-prd-rh03/kustomization.yaml
        @@ -1,12 +1,18 @@
         apiVersion: kustomize.config.k8s.io/v1beta1
         kind: Kustomization
         resources:
         - ../base
         namespace: mintmaker
        +
        +images:
        +  - name: quay.io/konflux-ci/mintmaker
        +    newName: quay.io/konflux-ci/mintmaker
        +    newTag: a3816e76f5e06ba3114731fc34fa14f76d442b6c
        +
         patches:
           - path: pipelines-as-code-secret-path.yaml
             target:
               name: pipelines-as-code-secret
               group: external-secrets.io
               version: v1beta1
               kind: ExternalSecret
        ```
        **Suggestion:** Remove lines 6-10.

    *   **File:** `components/mintmaker/production/kflux-rhel-p01/kustomization.yaml`
        ```diff
        --- a/components/mintmaker/production/kflux-rhel-p01/kustomization.yaml
        +++ b/components/mintmaker/production/kflux-rhel-p01/kustomization.yaml
        @@ -1,14 +1,20 @@
         apiVersion: kustomize.config.k8s.io/v1beta1
         kind: Kustomization
         resources:
         - ../base
         namespace: mintmaker
        +
        +images:
        +  - name: quay.io/konflux-ci/mintmaker
        +    newName: quay.io/konflux-ci/mintmaker
        +    newTag: a3816e76f5e06ba3114731fc34fa14f76d442b6c
        +
         patches:
           - path: pipelines-as-code-secret-path.yaml
             target:
               name: pipelines-as-code-secret
               group: external-secrets.io
               version: v1beta1
               kind: ExternalSecret
         components:
           - ../../components/rh-certs
        ```
        **Suggestion:** Remove lines 6-10.

    *   **File:** `components/mintmaker/production/stone-prod-p01/kustomization.yaml`
        ```diff
        --- a/components/mintmaker/production/stone-prod-p01/kustomization.yaml
        +++ b/components/mintmaker/production/stone-prod-p01/kustomization.yaml
        @@ -1,15 +1,21 @@
         apiVersion: kustomize.config.k8s.io/v1beta1
         kind: Kustomization
         resources:
         - ../base
         namespace: mintmaker
        +
        +images:
        +  - name: quay.io/konflux-ci/mintmaker
        +    newName: quay.io/konflux-ci/mintmaker
        +    newTag: a3816e76f5e06ba3114731fc34fa14f76d442b6c
        +
         patches:
           - path: pipelines-as-code-secret-path.yaml
             target:
               name: pipelines-as-code-secret
               group: external-secrets.io
               version: v1beta1
               kind: ExternalSecret
        
         components:
           - ../../components/rh-certs
        ```
        **Suggestion:** Remove lines 6-10.

2.  **Redundant RoleBinding in `rbac.yaml`:**
    The `rbac.yaml` file grants the `konflux-kubearchive` group both the `component-maintainer` ClusterRole and the `admin` ClusterRole within the `product-kubearchive-logging` namespace. The `admin` ClusterRole typically provides a superset of permissions compared to a `component-maintainer` role. Granting both is redundant. It's best practice to grant the least privilege necessary. If `admin` access is truly required for "manipulate resources", then the `component-maintainer` binding is unnecessary. If `component-maintainer` is sufficient, then `admin` should not be granted.

    *   **File:** `components/vector-kubearchive-log-collector/base/rbac.yaml`
        ```diff
        --- /dev/null
        +++ b/components/vector-kubearchive-log-collector/base/rbac.yaml
        @@ -0,0 +1,28 @@
        +---
        +kind: RoleBinding
        +apiVersion: rbac.authorization.k8s.io/v1
        +metadata:
        +  name: kubearchive-logging-component-maintainers
        +  namespace: product-kubearchive-logging
        +subjects:
        +  - kind: Group
        +    apiGroup: rbac.authorization.k8s.io
        +    name: konflux-kubearchive  # rover group
        +roleRef:
        +  apiGroup: rbac.authorization.k8s.io
        +  kind: ClusterRole
        +  name: component-maintainer
        +---
        +kind: RoleBinding
        +apiVersion: rbac.authorization.k8s.io/v1
        +metadata:
        +  name: kubearchive-logging-admin
        +  namespace: product-kubearchive-logging
        +subjects:
        +  - kind: Group
        +    apiGroup: rbac.authorization.k8s.io
        +    name: konflux-kubearchive  # rover group
        +roleRef:
        +  apiGroup: rbac.authorization.k8s.io
        +  kind: ClusterRole
        +  name: admin
        ```
        **Suggestion:** Remove the first `RoleBinding` (lines 1-14) if the `admin` role is intended to be granted, as it provides broader permissions.
        Alternatively, if `component-maintainer` is sufficient, remove the second `RoleBinding` (lines 15-28).
        Given the commit message "Make kubearchive admins" and "manipulate resources", it implies the `admin` role is the primary intent, making the `component-maintainer` role redundant.

        **Recommended Change (assuming `admin` is the desired level of access):**
        ```diff
        --- a/components/vector-kubearchive-log-collector/base/rbac.yaml
        +++ b/components/vector-kubearchive-log-collector/base/rbac.yaml
        @@ -0,0 +1,14 @@
        +---
        +kind: RoleBinding
        +apiVersion: rbac.authorization.k8s.io/v1
        +metadata:
        +  name: kubearchive-logging-admin
        +  namespace: product-kubearchive-logging
        +subjects:
        +  - kind: Group
        +    apiGroup: rbac.authorization.k8s.io
        +    name: konflux-kubearchive  # rover group
        +roleRef:
        +  apiGroup: rbac.authorization.k8s.io
        +  kind: ClusterRole
        +  name: admin
        ```
        This change removes lines 1-14 from the original new file.

Copy link

openshift-ci bot commented Aug 11, 2025

[APPROVALNOTIFIER] This PR is APPROVED

Approval requirements bypassed by manually added approval.

This pull-request has been approved by: maruiz93, mshaposhnik, rh-hemartin

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-merge-bot openshift-merge-bot bot merged commit 479ca23 into redhat-appstudio:main Aug 11, 2025
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants